package com.auxgroup.smarthome.business.service.inner;

import com.auxgroup.bridge.app.inner.vo.AppUserPushVo;
import com.auxgroup.bridge.app.inner.vo.AppUserVo;
import com.auxgroup.bridge.business.inner.vo.DeviceUserListVo;
import com.auxgroup.bridge.business.inner.vo.UserDeviceListVo;
import com.auxgroup.smarthome.business.service.AppUserDBInnerServiceFallback;
import com.auxgroup.smarthome.utils.PageContent;
import com.auxgroup.smarthome.web.ApiResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * Created by niuGuangzhe on 2017/8/10.
 */
@FeignClient(name = "INNER-SERVICE", fallback = AppUserDBInnerServiceFallback.class)
public interface AppUserDBInnerService {

    @GetMapping("/inner/app/users")
    ApiResponse<PageContent<AppUserVo>> getAppUserList(@RequestParam("keywords") String keywords, @RequestParam("page") Integer page, @RequestParam("size") Integer size);

    /**
     * 获取筛选后的到的用户
     * @return
     */
    @RequestMapping(value = "/inner/filterUsers", method = RequestMethod.GET)
    ApiResponse<List<AppUserPushVo>> filterUsers(@RequestParam("gender")String gender, Map map);

    @GetMapping(value = "/inner/app/users/{uid}/devices")
    ApiResponse<PageContent<UserDeviceListVo>> getUserDeviceList(@PathVariable("uid") String uid, @RequestParam("page") Integer page, @RequestParam("size") Integer size);

    @RequestMapping(value = "/inner/user", method = RequestMethod.GET)
    ApiResponse<AppUserVo> getAppUser(@RequestParam("uid") String uid);

    @GetMapping("/inner/products/devices/{mac}/users")
    ApiResponse<PageContent<DeviceUserListVo>> getDeviceUserList(@PathVariable("mac") String mac, @RequestParam("page") Integer page, @RequestParam("size") Integer size) ;

    @RequestMapping(value = "/inner/app/users/all", method = RequestMethod.GET)
    ApiResponse<List<AppUserVo>> getAllAppUser(@RequestParam(value = "keywords", required = false) String keywords);

}
